package com.aaa.controller;

import com.aaa.entity.OMS_Order;
import com.aaa.mapper.OMS_OrderMapper;
import com.aaa.service.OMS_OrderService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("oms_order")
public class OMS_OrderController {

    @Resource
    OMS_OrderService orderService;
    @Resource
    OMS_OrderMapper orderMapper;

    @RequestMapping("list")
    public List<OMS_Order> list() {
        return orderService.list();
    }

    @RequestMapping("select")
    public List<OMS_Order> select(Integer orderSn, String createTime) {
        return orderService.Oms_orderBy(orderSn, createTime);
    }

    /**
     * RequestParam 前台传递参数
     * @param page 页数
     * @param size 条数
     * @return
     */
    @RequestMapping("/findPage")
    public List<OMS_Order> fenye(@RequestParam(value = "page",defaultValue = "1") int page, @RequestParam(value = "size",defaultValue = "10") int size){
        //创建分页对象
        Page<OMS_Order> paged = new Page<>(page,size);
        List<OMS_Order> jobInfos = orderService.selectUserPage(paged);
        return jobInfos;
    }
}
